/*
 *  IMIBasePrefix.h
 *  IMIBase
 *
 *  Created by Travis on 09-7-12.
 *  Copyright 2009 imi.im All rights reserved.
 *
 */
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#define VERSION 0.5

#define IMIDefine static inline

#ifdef DEBUG

IMIDefine void
FunctionInfo(char* sourceFile, char* functionName, int lineNumber, NSString* format,...){
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	va_list ap;
	NSString *print, *file, *function;
	va_start(ap,format);
	file = [[NSString alloc] initWithBytes: sourceFile length: strlen(sourceFile) encoding: NSUTF8StringEncoding];
	
	function = [NSString stringWithCString: functionName];
	print = [[NSString alloc] initWithFormat: format arguments: ap];
	va_end(ap);
	NSLog(@"%@:%d %@ >>> %@", [file lastPathComponent], lineNumber, function, print);
	[print release];
	[file release];
	[pool release];
}

#define IMIDevLog(...) FunctionInfo(__FILE__, (char*)__FUNCTION__, __LINE__, __VA_ARGS__)
#define IMILog(...) NSLog(__VA_ARGS__)
#define MARK IMIDevLog(@"----- MARK -----")

#else
//do not log anything
#define IMIDevLog(...)
#define IMILog(...)
#define MARK

#endif


